<?php
namespace app\mobile\controller;

use app\BaseController;

use app\model\Distribution as SelfModel;

use think\facade\Cookie;
use think\facade\Request;
use think\facade\View;
class Distribution extends Base
{


    public function index($list_rows = 6)
    {
        $param = Request::param();
        $data = SelfModel::withSearch(array_keys($param), $param)
            ->where([['status', '=', 1]])
            ->order(['sort' => 'asc', 'id' => 'desc'])
            ->paginate($list_rows);


        return view('', ['data' => $data, 'list_rows' => $list_rows]);
    }

    public function view($id)
    {
        $data = SelfModel::find($id);
        return view('', ['info' => $data]);
    }

    public function ajax($list_rows)
    {
        $param = Request::param();
        $data = SelfModel::withSearch(array_keys($param), $param)
            ->where([['status', '=', 1]])
            ->order(['sort' => 'asc', 'id' => 'desc'])
            ->paginate($list_rows);
        return json(['code' => 200, 'message' => '最新数据', 'data' => $data]);
    }



}
